
import React from 'react';

import Button from 'bee-button';
import 'bee-button/build/Button.css';

import Modal from 'bee-modal';
import 'bee-modal/build/Modal.css';

import Icon from 'bee-icon';
import 'bee-icon/build/Icon.css';

import './index.less'
class CreateModal extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            show: false,
            title: '',
            content: '',
            confirm: null,
            cancel: null
        };
        this.output = {
            isShow: this.isShow
        };

    }
    render() {
        let { btnTpl } = this.props;
        return (
            <div>
                <Modal
                    className="ygc-create-modal"
                    show={this.state.show}
                >
                    <Modal.Header>
                        <Modal.Title > 提示信息 </Modal.Title >
                    </Modal.Header >
                    <Modal.Body >
                        <div className="message-box">
                            <Icon type="uf-exc-c-2" className="message-icon" />
                            {this.state.title}
                        </div>
                        <div className="message-detail">{this.state.content}</div>
                    </Modal.Body>
                    <Modal.Footer>
                        <Button colors="primary" onClick={this.sureClick}> 确定 </Button>
                        <Button className="cancel-btn" bordered onClick={this.cancelClick}> 取消 </Button>
                    </Modal.Footer>
                </Modal>
            </div>
        )
    }
    sureClick = () => {
        this.setState({
            show: false
        }, () => {
            this.state.confirm && this.state.confirm()
        });
    };
    cancelClick = () => {
        this.setState({
            show: false
        }, () => {
            this.state.cancel && this.state.cancel()
        });
    }
    close = () => {
        this.setState({
            show: false
        });
    }
    isShow = ({ show, title, content, confirm, cancel }) => {
        console.log(show, title, content, confirm, cancel)
        show = show ? true : false;
        title = title ? title : '请注意!';
        content = content ? content : null;
        this.setState({
            show, title, content, confirm, cancel
        });
    }
}



function YGCCreateModal(params) {
    return <CreateModal
        ref={child => this.promptModal = child}
        {...params}
    />
}

export default YGCCreateModal;